home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Leser 19 / Amiga Plus Leser CD 19.iso / Tools / MorphOS / cvs-1.11.2 / source / amiga / netinclude / netinet / in_var.h < prev    next >
Encoding:
C/C++ Source or Header  |  2002-11-18  |  4.2 KB  |  104 lines

  1. /*
  2.  * Copyright (c) 1985, 1986, 1993
  3.  *    The Regents of the University of California.  All rights reserved.
  4.  *
  5.  * Redistribution and use in source and binary forms, with or without
  6.  * modification, are permitted provided that the following conditions
  7.  * are met:
  8.  * 1. Redistributions of source code must retain the above copyright
  9.  *    notice, this list of conditions and the following disclaimer.
  10.  * 2. Redistributions in binary form must reproduce the above copyright
  11.  *    notice, this list of conditions and the following disclaimer in the
  12.  *    documentation and/or other materials provided with the distribution.
  13.  * 3. All advertising materials mentioning features or use of this software
  14.  *    must display the following acknowledgement:
  15.  *    This product includes software developed by the University of
  16.  *    California, Berkeley and its contributors.
  17.  * 4. Neither the name of the University nor the names of its contributors
  18.  *    may be used to endorse or promote products derived from this software
  19.  *    without specific prior written permission.
  20.  *
  21.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  22.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  23.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  24.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  25.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  26.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  27.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  28.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  29.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  30.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  31.  * SUCH DAMAGE.
  32.  *
  33.  *    @(#)in_var.h    8.2 (Berkeley) 1/9/95
  34.  */
  35.  
  36. #ifndef _NETINET_IN_VAR_H
  37. #define _NETINET_IN_VAR_H
  38.  
  39. #ifndef _NETINET_IN_H
  40. #include <netinet/in.h>
  41. #endif /* _NETINET_IN_H */
  42.  
  43. #ifndef _NET_IF_H
  44. #include <net/if.h>
  45. #endif /* _NET_IF_H */
  46.  
  47. /*
  48.  * Interface address, Internet version.  One of these structures
  49.  * is allocated for each interface with an Internet address.
  50.  * The ifaddr structure contains the protocol-independent part
  51.  * of the structure and is assumed to be first.
  52.  */
  53. struct in_ifaddr {
  54.     struct    ifaddr ia_ifa;        /* protocol-independent info */
  55. #define    ia_ifp        ia_ifa.ifa_ifp
  56. #define ia_flags    ia_ifa.ifa_flags
  57.                     /* ia_{,sub}net{,mask} in host order */
  58.     ULONG    ia_net;            /* network number of interface */
  59.     ULONG    ia_netmask;        /* mask of net part */
  60.     ULONG    ia_subnet;        /* subnet number, including net */
  61.     ULONG    ia_subnetmask;        /* mask of subnet part */
  62.     struct    in_addr ia_netbroadcast; /* to recognize net broadcasts */
  63.     struct    in_ifaddr *ia_next;    /* next in list of internet addresses */
  64.     struct    sockaddr_in ia_addr;    /* reserve space for interface name */
  65.     struct    sockaddr_in ia_dstaddr; /* reserve space for broadcast addr */
  66. #define    ia_broadaddr    ia_dstaddr
  67.     struct    sockaddr_in ia_sockmask; /* reserve space for general netmask */
  68.     struct    in_multi *ia_multiaddrs; /* list of multicast addresses */
  69. };
  70.  
  71. struct    in_aliasreq {
  72.     UBYTE    ifra_name[IFNAMSIZ];        /* if name, e.g. "en0" */
  73.     struct    sockaddr_in ifra_addr;
  74.     struct    sockaddr_in ifra_broadaddr;
  75. #define ifra_dstaddr ifra_broadaddr
  76.     struct    sockaddr_in ifra_mask;
  77. };
  78. /*
  79.  * Given a pointer to an in_ifaddr (ifaddr),
  80.  * return a pointer to the addr as a sockaddr_in.
  81.  */
  82. #define    IA_SIN(ia) (&(((struct in_ifaddr *)(ia))->ia_addr))
  83.  
  84. #define IN_LNAOF(in, ifa) \
  85.     ((ntohl((in).s_addr) & ~((struct in_ifaddr *)(ifa)->ia_subnetmask))
  86.             
  87.  
  88. /*
  89.  * Internet multicast address structure.  There is one of these for each IP
  90.  * multicast group to which this host belongs on a given network interface.
  91.  * They are kept in a linked list, rooted in the interface's in_ifaddr
  92.  * structure.
  93.  */
  94. struct in_multi {
  95.     struct    in_addr inm_addr;    /* IP multicast address */
  96.     struct    ifnet *inm_ifp;        /* back pointer to ifnet */
  97.     struct    in_ifaddr *inm_ia;    /* back pointer to in_ifaddr */
  98.     ULONG    inm_refcount;        /* no. membership claims by sockets */
  99.     ULONG    inm_timer;        /* IGMP membership report timer */
  100.     struct    in_multi *inm_next;    /* ptr to next multicast address */
  101. };
  102.  
  103. #endif /* _NETINET_IN_VAR_H */
  104.